#ifndef MODULE_H
#define MODULE_H

#include <cstdint>

using u8 = unsigned char;
typedef unsigned int u32;

class smodule {
public:
    smodule() = default;

    explicit smodule(const char *name);

    virtual ~smodule() = default;

    virtual int run(u32 tick) = 0;

    virtual int begin(u32 tick) = 0;

    virtual int diag(u32 tick) = 0;

    int try_run(u32 tick);

    const char *name{};
    static smodule *modules[];

    int loop();

    uint8_t state = 0;
};


#endif